<template>
  <div class="all" :class="isZiliao === true ? 'backFFF' : ''">

    <div class="top" style="width: 100%;position: sticky;top: 0">
      <!--     评估-->
      <header v-show="isZiliao === false">
        <div class="div" @click="back">
          <span class="side" style="margin-left: 15px">上一步</span>
        </div>
        <div class="div">
          <span>评定量表填写</span>
        </div>
        <div class="div">
          <span class="side" @click="send" v-show="arr.isSend !== true">完成</span>
        </div>
      </header>
      <div v-show="isZiliao === false" class="menu">
        <el-steps :active="menuIndex" align-center>
          <el-step title="" v-for="(item, index) in  menuList" :key="index"
                   @click.native="changeMenu(index, url)"
                   process-status="success"
                   :description="item.title">
            <template #icon>
              <div v-if="menuIndex >= index" style="width: 15px;height: 15px;">
                <img src="../../assets/步骤选择.png" style="width: 15px;height: 15px;" alt="">
              </div>
              <div v-else style="width: 6px;height: 15px;background: #1DA4F2;display: flex;align-items: center;justify-content: center">
                <a style="width: 6px;height: 6px;border-radius: 50%;background: white;display: flex;position: absolute;"></a>
              </div>
            </template>
          </el-step>
        </el-steps>
      </div>
      <!--    评估-->
      <div class="peopletitle" v-show="isZiliao === false">
        <img :src="peopleList.PHOTO" v-if="peopleList.PHOTO !== null && peopleList.PHOTO !== undefined && peopleList.PHOTO !== ''" alt="">
        <img v-else src="../../assets/photo.png" alt="">
        <span>{{peopleList.name}}</span>
        <span>|</span>
        <span v-show="peopleList.SEX == 1 || peopleList.sex == 1">男</span>
        <span v-show="peopleList.SEX == 2 || peopleList.sex == 2">女</span>
        <span>|</span>
        <span>{{peopleList.age}} 岁</span>
      </div>
      <div v-show="isZiliao === false" class="title">
        <p>{{arr.ASSESS_NAME}}</p>
        <p style="justify-content: space-between">
          <button @click="clickNodoing()">
            <img src="../../assets/量表说明@2x.png" alt="">
            量表说明</button>
          <span style="font-size: 14px;margin-left: 10px">
          评定总分:
          <a class="solt" v-if="arr.ALL_POINTS !== undefined">{{arr.ALL_POINTS}}</a>
          <a class="solt" v-else>0</a>分
        </span>
          <button class="checkBtn" @click="show = !show">
            <img src="../../assets/已选中量表列表@2x.png" alt="">
            已选中量表列表
          </button>
        </p>
      </div>

    </div>
<!--    资料上传-->
    <header v-show="isZiliao === true">
      <div class="div" @click="zlBack">
        <img src="../../assets/返回.png" alt="">
        <span class="side">返回</span>
      </div>
      <div class="div">
        <span>评定相关资料</span>
      </div>
      <div class="div">
        <span class="side" @click="Shangchuan()" v-show="arr.isSend !== true">上传</span>
      </div>
    </header>

    <div v-show="isZiliao === false" class="content">
      <van-loading size="24px" style="color: #1da4f2" vertical v-show="isLoading === true">加载中...</van-loading>
      <ul v-for="(item, index) in arr.subjects" :key="index">
        <li class="liHeader">
          <p>{{index+1}}、{{item.SUBJECT_NAME}}</p>
          <p class="p_btn">
            <button @click="clickZL(item)" v-if="item.isSendFile !== true">资料上传</button>
            <button @click="clickZL(item)" style="background: rgba(29, 164, 242, 0.1);color: #1da4f2" v-else>资料已上传</button>
            <img @click="clickNodoing()" :disabled="item.isSend" src="../../assets/帮助小@2x.png" alt="">
          </p>
        </li>
        <li class="liChoos"
            v-for="(chooseItem, chooseIndex) in item.chooses"
            :key="chooseIndex"
            @click="clickChoose(item.chooses, chooseItem, item)">
          <img
            class="selectBtn" :src="[chooseItem.select === true ? require('../../assets/题目选择.png') : require('../../assets/题目未选择.png')]"
               alt="">
          {{chooseItem.CHOOSE_NAME}} ({{chooseItem.POINTS}}分)
        </li>
      </ul>
    </div>
    <div v-show="isZiliao === false" class="bottom">
      <ul>
        <li>* 评定结果</li>
        <li>
          <textarea
           v-model="result"></textarea>
          <p>小提示：结果可编辑</p>
        </li>
      </ul>
    </div>
    <van-dialog v-model="isPop"
                width="80%"
                title="是否需要提交审核？"
                @confirm="onConfirm()"
                @cancel="onCancel()"
                confirmButtonColor="#1da4f2"
                show-cancel-button>
    </van-dialog>
    <v-touch v-on:swipeleft="onSwipeLeft" v-on:swiperight="onSwipeRight" >
      <van-popup class="pop" v-model="show" position="left" :style="{ width: '70%', height: '100%' }" >
        <v-touch v-on:swipeleft="onSwipeLeft" v-on:swiperight="onSwipeRight" >
        <ul>
        <li v-for="(item, index) in selectList" @click="clickLi(index)" :key="index">
          <img src="../../assets/评估量表小@2x.png" alt="">
          <span>
            {{item.ASSESS_NAME}}
          </span>
          <div class="jiaoBiao jiaoBiao2" v-if="item.isSend === true">
            <a class="dian dian2"></a>
            <a>已完成</a>
          </div>
          <div class="jiaoBiao jiaoBiao1"  v-else>
            <a class="dian dian1"></a>
            <a>未完成</a>
          </div>
        </li>
      </ul>
        </v-touch>
    </van-popup>
    </v-touch>
      <!-- 资料上传 -->
    <div v-show="isZiliao === true"  class="zlMenu" @click="showPicker = true">
      <div>
        <a></a>
        <span>针对项目</span>
      </div>
      <div style="width: 70%">
        <span style="
margin-right: 8px;
font-size: 15px;
font-family: PingFang SC;
font-weight: 500;
color: #999999;
display: inline-block;
white-space: nowrap;
width: 100%;
overflow: hidden;
text-overflow:ellipsis;
text-align: right
"
        >{{zhenDuiName}}</span>
        <img src="../../assets/下弹灰@2x.png" v-show="showPicker === false" alt="">
        <img src="../../assets/上弹灰@2x.png" v-show="showPicker === true" alt="">
      </div>
    </div>
<!--    <van-action-sheet v-model="showPicker"-->
<!--                      :actions="actions"-->
<!--                      @select="onSelect" />-->
    <van-overlay :show="showPicker">
      <div class="wrapper" @click.stop>
        <div class="block" >
          <p class="pHeader">请选择针对的项目</p>
          <ul>
            <li v-for="(item, index) in actions" :key="index" @click="onSelect(item)">
              <span class="yuan"></span>
              <a v-show="index === 0">评定项目：{{item.name}}</a>
              <a v-show="index === 1">{{item.name}} : {{arr.ASSESS_NAME}}</a>
            </li>
          </ul>
        </div>
      </div>
    </van-overlay>
    <div v-show="isZiliao === true" @click="PlayVideo"  class="video">
<!--      <div class="videoMenu">
       <li class="videoMenu_left">
          <a></a>
          <span>上传影像资料</span>
       </li>
        <li>
          {{fileList.length}}/1
        </li>
      </div>-->
      <div class="videoUpload">
        <van-uploader v-model="fileList"
                      :upload-icon="require('../../assets/视频上传.png')"
                      multiple
                      accept="video/*, .mp4"
                      @delete="DelVideo"
                      :after-read="afterRead"
                      :max-count="1" />
      </div>
    </div>
    <div v-show="isZiliao === true"  class="IMG">
      <div class="imgMenu">
       <li class="imgMenu_left">
          <a></a>
          <span>上传图片资料</span>
       </li>
        <li>
          不限
        </li>
      </div>
      <div class="videoUpload">
        <van-uploader v-model="ImgfileList"
                      :upload-icon="require('../../assets/上传图片.png')"
                      multiple
                      :after-read="updateFile"
        />
      </div>
    </div>
    <div v-show="isZiliao === true"  class="zlTitle">
      <!--      class="zlTitle"-->
      <div class="label">
        <a class="hengGang"></a>
        <span>情况说明</span>
      </div>
      <!--      <li>-->
      <!--        <span>情况</span>-->
      <!--        <span>说明</span>-->
      <!--      </li>-->
      <li class="textareaDiv">
        <textarea v-model="desc" maxlength="100"></textarea>
        <span class="shuoming">限100字以内</span>
      </li>
    </div>

<!--     选医生-->
    <van-popup
      v-model="doctorShow"
      round
      :close-on-click-overlay="false"
      position="bottom"
      :style="{ height: '80%', bottom: '50px' }">
      <div class="popDiv" ref="box">
        <div class="popTop">
          <div class="popHeader" style="">
            <span style="width: 30%;">
            </span>
            <span style="width: 40%;display: flex;
          justify-content: center;">
              请选择医生
            </span>
            <span v-if="tabBarIndex == 0" @click="doctorSelectQue" style="width: 30%;color:#1DA4F2;display: flex;justify-content: flex-end">
              确定
            </span>
            <span v-else style="width: 30%;color:#1DA4F2;display: flex;justify-content: flex-end"></span>
          </div>
          <ul class="tabBar">
            <li :class="tabBarIndex == 0 ? 'selectMenu' : ''" @click="tabBarIndex = 0, select_doc_ID='',select_team_ID=''">医生</li>
            <li :class="tabBarIndex == 1 ? 'selectMenu' : ''" @click="tabBarIndex = 1,page=1,getTeamList(), select_doc_ID='',select_team_ID=''">团队</li>
          </ul>
        </div>
        <div class="box"
             v-show="tabBarIndex == 0"
             @click="clickBox(item)"
             :class="select_doc_ID == item.USER_ID ? 'selectDoctor' : ''"
             v-for="(item, index) in doctorsList" :key="index">
          <div class="box_left">
            <img v-if="item.PHOTO !== '' && item.PHOTO !== undefined && item.PHOTO !== null" :src="item.PHOTO" class="PHOTO" alt="">
            <img v-else src="../../assets/男医生@2x.png" class="PHOTO" alt="">
          </div>
          <div class="box_right">
            <ul>
              <li>
                  <span class="name">
                    <span style="font-weight: bold;font-size: 15px">{{item.NICK_NAME}}</span>
      <!--              <span>|</span>-->
      <!--              <span style="font-weight: 500;font-size: 13px !important;">{{item.MAJOR}}</span>-->
      <!--              <span>|</span>-->
      <!--              <span style="font-weight: 500;font-size: 13px !important;">{{item.DEPART}}</span>-->
                  </span>
              </li>
              <li>
                <span style="font-weight: 500;font-size: 13px !important;">{{item.MAJOR}}</span>
                <span>|</span>
                <span style="font-weight: 500;font-size: 13px !important;">{{item.DEPART}}</span>
              </li>
              <li>
                <span class="jieShao">{{item.HOSPITAL_NAME}}</span>
                <button class="biaoqian" v-if="item.GRADE">{{item.GRADE}}</button>
              </li>
            </ul>
<!--            <div class="box_rigth_bottom">
              <p>
                <a >接诊率:</a><span>{{item.jiezhenCount}}</span>
                <a >好评率:</a><span>{{item.haopingLv}}</span>
                <a >咨询量:</a><span>{{item.zixunCount}}</span>
              </p>
              <p class="goodAt">
                <a style="display: block">擅长:</a>
                <span>{{item.Goodat}}</span>
              </p>
              <p>
                <a >最快回复:</a>
                <span style="color: #1DA4F2"  v-if="item.min !== undefined && item.min !== null && item.min !== ''">{{item.min}}</span>
                <span v-else style="color: #999999">暂无</span>
                <a >平均回复:</a>
                <span style="color: #1DA4F2" v-if="item.avg !== undefined && item.avg !== null && item.avg !== ''">{{item.avg}}</span>
                <span style="color: #999999" v-else>暂无</span>
              </p>
            </div>-->
          </div>
        </div>
        <div class="box"
             v-show="tabBarIndex == 1"
             @click="clickBox(item)"
             :class="select_team_ID == item.id ? 'selectDoctor' : ''"
             v-for="(item, index) in teamList" :key="index">
          <div class="box_left">
            <img v-if="item.team_icon !== '' && item.team_icon !== undefined && item.team_icon !== null"
                 :src="item.team_icon" class="PHOTO" alt="">
            <img v-else src="../../assets/男医生@2x.png" class="PHOTO" alt="">
          </div>
          <div class="box_right">
            <ul>
              <li>
                <span class="name">
                  {{item.team_name}}
                  <a style="font-size: 13px;font-weight: 500">（{{item.count}}人）</a>
                </span>
              </li>
              <li>
                <span>团队长：{{item.NICK_NAME}}</span>
                &nbsp;
                &nbsp;
                &nbsp;
<!--                <span>团队人数：{{item.count}}人</span>-->
                <span style="font-weight: 500;font-size: 13px !important;">{{item.MAJOR}}</span>
                <span> &nbsp;| &nbsp;</span>
                <span style="font-weight: 500;font-size: 13px !important;">{{item.DEPART}}</span>
              </li>
              <li>
                <span class="jieShao">{{item.HOSPITAL_NAME}}</span>
                <button class="biaoqian">{{item.GRADE}}</button>
              </li>
            </ul>
          </div>
        </div>
        <van-loading v-show="isLoading" size="24px" style="width: 100%;height: 80%;
    display:flex;align-items:center;justify-content:center; color: #1da4f2" vertical>
          加载中...
        </van-loading>
        <van-empty
          style="width: 100%;height: 60%"
          v-show="((tabBarIndex == 0 && doctorsList.length <= 0) || (tabBarIndex == 1 && teamList.length <= 0)) && isLoading === false"
          class="custom-image"
          :image="require('../../assets/空两本书.png')"
          :description=" `暂无`+typeText"
        />
      </div>
    </van-popup>
    <!--     选团队医生-->
    <van-popup
      v-model="teamDoctorShow"
      round
      :close-on-click-overlay="false"
      position="bottom"
      :style="{ height: '80%', bottom: '50px' }">
      <div class="popDiv" ref="box">
          <div class="popHeader" style="">
            <span @click="teamDoctorShow = false" style="width: 30%;" class="solt">
              返回
            </span>
            <span style="width: 40%;display: flex;
            justify-content: center;">
              请选择医生
            </span>
            <span  @click="doctorSelectQue" style="width: 30%;color:#1DA4F2;display: flex;justify-content: flex-end">
              确定
            </span>
          </div>
        <div class="box"
             @click="clickTeamBox(item)"
             :class="assess_audit_user_id == item.USER_ID ? 'selectDoctor' : ''"
             v-for="(item, index) in teamDoctorsList" :key="index">
          <div class="box_left">
            <img v-if="item.PHOTO" :src="item.PHOTO" class="PHOTO" alt="">
            <img v-else src="../../assets/男医生@2x.png" class="PHOTO" alt="">
          </div>
          <div class="box_right">
            <ul>
              <li>
            <span class="name">
              <span style="font-weight: bold;font-size: 15px">{{item.NICK_NAME}}</span>
              <span>|</span>
              <span style="font-weight: 500;font-size: 13px !important;">{{item.MAJOR}}</span>
              <span>|</span>
              <span style="font-weight: 500;font-size: 13px !important;">{{item.DEPART}}</span>
            </span>
              </li>
              <li>
                <span class="jieShao">{{item.HOSPITAL_NAME}}</span>
                <button class="biaoqian" v-if="item.GRADE">{{item.GRADE}}</button>
              </li>
            </ul>
            <div class="box_rigth_bottom">
              <p>
                <a >接诊率:</a><span>{{item.jiezhenCount}}</span>
                <a >好评率:</a><span>{{item.haopingLv}}</span>
                <a >咨询量:</a><span>{{item.zixunCount}}</span>
              </p>
              <p class="goodAt">
                <a style="display: block">擅长:</a>
                <span>{{item.Goodat}}</span>
              </p>
              <p>
                <a >最快回复:</a>
                <span style="color: #1DA4F2"  v-if="item.min !== undefined && item.min !== null && item.min !== ''">{{item.min}}</span>
                <span v-else style="color: #999999">暂无</span>
                <a >平均回复:</a>
                <span style="color: #1DA4F2" v-if="item.avg !== undefined && item.avg !== null && item.avg !== ''">{{item.avg}}</span>
                <span style="color: #999999" v-else>暂无</span>
              </p>
            </div>
          </div>
        </div>
<!--        <van-loading v-show="teamLoading" size="24px" style="width: 100%;height: 80%;-->
<!--    display:flex;align-items:center;justify-content:center; color: #1da4f2" vertical>-->
<!--          加载中...-->
<!--        </van-loading>-->
<!--        <van-empty-->
<!--          style="width: 100%;height: 60%"-->
<!--          v-show="teamDoctorsList.length <= 0 && teamLoading === false"-->
<!--          class="custom-image"-->
<!--          :image="require('../../assets/空两本书.png')"-->
<!--          :description=" `暂无`+typeText"-->
<!--        />-->
      </div>
    </van-popup>
<!--     结果预览-->
    <van-popup v-model="tableShow"
               round
               :close-on-click-overlay="true"
               position="bottom"
               :style="{ height: '80%', bottom: '50px' }">
      <div class="tab">
        <div class="tabHeader">
          <div class="solt" style="margin-left:15px" @click="tableShow = false">返回</div>
          <div>评定量表结果预览</div>
          <div class="solt" v-if="selfInformation.name == assess_user_name" @click="tabResultLook()">签字确认</div>
          <div class="solt"
               v-else
               @click="tabResultLook()"
               >提交</div>
        </div>
        <div class="tabTitle">
          {{arr.ASSESS_NAME}}
        </div>
        <div class="tabPerson">
          <p class="tabName">
            <span>姓名：{{peopleList.name}}</span>
            <span>性别：
              <a v-if="peopleList.sex == 1">男</a>
              <a v-else-if="peopleList.sex == 2">女</a>
            </span>
            <span>年龄：{{peopleList.age}}</span>
          </p>
          <p>联系电话：{{peopleList.phone}}</p>
          <p>初步诊断：{{diagnose}}</p>
          <p>联系地址：{{peopleList.zuizhongAddress}}</p>
          <p>评定总分：{{tableList.ALL_POINTS}}分</p>
          <p>评定来源：{{assessTypeName}}</p>
          <p>评定日期：{{todayDate}}</p>
          <p>评定结果：</p>
          <div class="tabTextarea">
            <textarea name="" v-model="tableList.result" readonly id="" cols="30" rows="10"></textarea>
          </div>
          <p>评定人员： {{assess_user_name}}</p>
        </div>
        <div class="label" style="margin-top: 5px;margin-bottom: 5px">
          <a class="hengGang"></a>评定项目及评定项目结果
        </div>
        <div class="tabContent">
          <ul v-for="(item, index) in tableList.subjects" :key="index">
            <li class="liHeader">
              <p>{{index+1}}、{{item.SUBJECT_NAME}}</p>
              <p class="p_btn"></p>
            </li>
            <li class="liChoos"
                v-for="(chooseItem, chooseIndex) in item.chooses"
                :key="chooseIndex"
               >
              <img
                class="selectBtn" :src="[chooseItem.select === true ? require('../../assets/题目选择.png') : require('../../assets/题目未选择.png')]"
                alt="">
              {{chooseItem.CHOOSE_NAME}} ({{chooseItem.POINTS}}分)
            </li>
          </ul>
        </div>
      </div>
    </van-popup>
<!--    <van-popup v-model="tableShow"
               round
               :close-on-click-overlay="true"
               position="bottom"
               :style="{ height: '80%', bottom: '50px' }">
      <div class="tabTop">
        <div class="tabHeader">
          <div style="margin-left:15px" @click="tableShow = false">关闭</div>
          <div>结果预览</div>
          <div class="solt" @click="tabResultLook()">提交</div>
        </div>
        <div class="tabTitle">
          {{arr.ASSESS_NAME}}
        </div>
        <div>
          <table style="width: 100%"
                 border="0"
                 cellspacing="0"
                 cellpadding="0">
            <thead>
            <tr style="color: white;background: #1DA4F2">
              <th>序号</th>
              <th>评估项</th>
              <th>评估项结果</th>
              <th>得分</th>
            </tr>
            <tr style="color: #1DA4F2;background: rgba(229, 229, 229, 0.5)">
              <td>0</td>
              <td>综合评估</td>
              <td style="white-space:normal;word-break:break-all;word-wrap: break-word;">{{tableList.result}}</td>
              <td>{{tableList.ALL_POINTS}}
                <span v-show="Number(tableList.ALL_POINTS) > 0">分</span></td>
            </tr>
            </thead>
          </table>
        </div>
      </div>
      <div>
        <table style="width: 100%;" border="0" cellspacing="0" cellpadding="0">
          <tbody>
          <tr v-for="(item, index) in tableList.subjects" :key="index">
            <td>{{index + 1}}</td>
            <td>{{item.SUBJECT_NAME}}</td>
            <td >
              <span v-for="(choosesItem, choosesIndex) in item.chooses" :key="choosesIndex" v-if="choosesItem.select === true">{{choosesItem.CHOOSE_NAME}}</span>
            </td>
            <td>
              <span v-for="(choosesItem, choosesIndex) in item.chooses" :key="choosesIndex" v-if="choosesItem.select === true">
                {{choosesItem.POINTS}}<span v-show="Number(choosesItem.POINTS) > 0">分</span>
              </span>
&lt;!&ndash;              {{item.POINTS}}&ndash;&gt;
&lt;!&ndash;              <span v-show="Number(choosesItem.POINTS) > 0">分</span>&ndash;&gt;
            </td>
          </tr>
          </tbody>
        </table>
      </div>
    </van-popup>-->
    <van-popup   v-model="writeShow"
                 :close-on-click-overlay="false"
                 position="bottom"
                 :style="{ height: '80%', bottom: '50px' }">
      <div class="tabHeader">
        <div class="solt" @click="writeCncel" style="margin-left: 15px">返回</div>
        <div>签名</div>
        <div></div>
      </div>
      <div class="label">
        <a class="hengGang"></a>
        <span>请手写签名</span>
      </div>
      <div class="writeDiv" :style="{height: '70%', overflow: 'hidden'}">
<!--        :width="800"-->
<!--        :height="2000"-->
        <vue-esign ref="esign" style="background: #1da4f2;width: 100%;height: 100%;"
                   :isCrop="isCrop" :lineWidth="lineWidth" :lineColor="lineColor" :bgColor.sync="bgColor" />
      </div>
      <div class="writeButton">
        <button @click="handleReset()">清除</button>
        <button class="backBlue" @click="handleGenerate()"> 确认</button>
      </div>
    </van-popup>
    <van-dialog v-model="imgBackToast"
                width="80%"
                title="当前资料未保存是否确认返回？"
                @confirm="imgBackConfirm()"
                @cancel="imgBackToast = false"
                confirmButtonColor="#1da4f2"
                show-cancel-button>
    </van-dialog>
    <van-dialog v-model="NoDoctor"
                width="80%"
                title="您目前暂无可审核人员，是否确认提交？"
                @confirm="NoDoctorConfirm()"
                @cancel="NoDoctor = false"
                confirmButtonColor="#1da4f2"
                show-cancel-button>
    </van-dialog>
  </div>
</template>

<script>
import $ from 'jquery'
import {Toast} from 'vant'
import lrz from 'lrz'
export default {
  name: 'AssessmentScale',
  data () {
    return {
      isLoading: true,
      showPicker: false,
      actions: [], // 针对项目包含内容
      zhenDuiName: '',
      fileList: [], // 视频存储
      videoList: [], // 视频返回后存储
      ImgfileList: [], // 图片存储
      imgList: [], // 图片返回后存储
      isZiliao: false, // 是否是资料页面
      isPop: false, // 审核弹窗
      selectList: [], // 选择的表
      show: false, // 已选中量表列表
      type: 0,
      assessid: '',
      ID: '',
      list: [],
      listAll: [],
      ListIndex: 0, // 已选中量表所处表位置
      arr: [], // 当前选中量表的题目
      ALL_POINTS: 0, // 当前量表选中后的总分
      result: '', // 当前量表的评估结果
      answers: [], // 封装的提交 已选择的
      ACCEPT_USER_ID: '',
      nowItem: '', // 当前点击的题目
      desc: '', // 上传图片里面的说明
      imgSend: true,
      value1: '',
      option1: [
        {
          text: '全部类型',
          value: ''
        }
      ],
      Searchvalue: '',
      tableShow: false,
      tableList: [],
      returnID: '',
      peopleList: [],
      // 签字数据
      writeShow: false,
      lineWidth: 4,
      lineColor: '#000000',
      bgColor: '',
      isCrop: false,
      height: 0,
      sign_url: '', // 签名地址
      imgBackToast: false,
      diagnose: '', // 初步诊断
      assess_type: '',
      menuIndex: 4,
      menuList: [
        {
          title: '选择人员',
          url: '/selectAssessor'
        },
        {
          title: '信息录入',
          url: '/enterPingGu'
        },
        {
          title: '选择类型',
          url: '/assessmentType'
        },
        {
          title: '选择量表',
          url: '/selectionAssessment'
        },
        {
          title: '量表填写',
          url: '/assessmentScale'
        }
      ],
      NoDoctor: false,
      // 选择医生团队弹出窗 参数
      doctorShow: false,
      doctorsList: [],
      tabBarIndex: 0,
      select_team_ID: '',
      select_doc_ID: '',
      page: 1,
      isScroll: true,
      teamDoctorsList: [],
      teamDoctorShow: false,
      assess_audit_user_id: '' // 被审核评估患者userid
    }
  },
  computed: {
    // 选中医生/团队弹窗
    typeText () {
      if (this.tabBarIndex == 0) {
        return '医生'
      } else if (this.tabBarIndex == 1) {
        return '团队'
      }
    },
    selfInformation: function () {
      return JSON.parse(sessionStorage.getItem('selfInformation'))
    },
    assess_user_name: function () {
      return sessionStorage.getItem('assess_user_name')
    },
    assessTypeName: function () {
      let assessType = Number(sessionStorage.getItem('assess_type'))
      if (assessType === 1) {
        return '门诊专业评定'
      } else if (assessType === 2) {
        return '住院专业评定'
      } else if (assessType === 3) {
        return '居家自评'
      } else if (assessType === 4) {
        return '居家非专业医疗人士评定'
      } else if (assessType === 5) {
        return '居家专业医疗人士评定'
      }
    },
    todayDate: function () {
      return new Date().getFullYear() + '年' + Number(new Date().getMonth() + 1) + '月' + new Date().getDate() + '日'
    }
  },
  mounted () {
    // 初步诊断
    this.diagnose = sessionStorage.getItem('diagnose')
    if (this.diagnose === 'null') {
      this.diagnose = ''
    }
    this.assess_type = sessionStorage.getItem('assess_type')
    if (window.sessionStorage.getItem('ACCEPT_USER_ID') !== null && window.sessionStorage.getItem('ACCEPT_USER_ID') !== undefined) {
      this.ACCEPT_USER_ID = sessionStorage.getItem('ACCEPT_USER_ID')
    }
    this.assessid = this.$utils.getUrlKey('assessid')
    this.type = this.$utils.getUrlKey('type')
    // 已选择
    this.selectList = JSON.parse(window.sessionStorage.getItem('selData'))
    $('.content').css('max-height', $(window).height() - $('.content').offset().top - $('.bottom').outerHeight() - 50 + 'px')
    this.getList()

    // 获取医生类型
    this.getJiankangServiceList()

    // 获取所有医生信息
    this.getDoctorList()
    // 获取团队信息
    this.getTeamList()

    // 获取个人基本信息
    this.getPerson()
  },
  methods: {
    // 滚动事件
    scrollBottom () {
      let scrollTop = this.$refs.box.scrollTop
      let clientHeight = this.$refs.box.clientHeight
      let scrollHeight = this.$refs.box.scrollHeight
      if (scrollHeight - scrollTop <= clientHeight + 300 && this.isScroll === true) {
        this.isScroll = false
        setTimeout(() => {
          this.page += 1
          this.popLoading = true
          // 移除滚动事件
          window.removeEventListener('scroll', this.scrollBottom, true)
          this.getTeamList()
        }, 500)
      }
    },
    // 选择团队医生
    clickTeamBox (item) {
      this.assess_audit_user_id = item.USER_ID
    },
    // 选择医生或团队
    clickBox (item) {
      this.assess_audit_user_id = ''
      if (this.tabBarIndex == 0) { // 直接选医生
        this.select_team_ID = ''
        this.select_doc_ID = item.USER_ID
      } else if (this.tabBarIndex == 1) { // 选团队
        // this.select_doc_ID = item.manager_doc_id
        this.select_team_ID = item.id
        this.getTeamDoctor()
        this.teamDoctorShow = true
      }
    },
    // 提交审核无档案人员  确认提交
    NoDoctorConfirm () {
      this.getSubmit()
      this.NoDoctor = false
    },
    // 点击❓
    clickNodoing () {
      Toast('暂无说明')
    },
    // 获取个人基本信息
    getPerson () {
      this.$http.findUserXinXiTuoMin({'data_user_id': this.ACCEPT_USER_ID})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.peopleList = res.data.data
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 删除视频
    DelVideo (file, detail) {
      this.fileList = [] // 视频存储
      this.videoList = [] // 视频返回后存储
    },
    // 点击提交
    send () {
      if (this.result === '' || this.result === undefined || this.result === null) {
        Toast('请填写评定结果')
        return false
      }
      this.answers = []
      var _this = this
      var isSelect = false
      this.arr.subjects.forEach(function (currentValue, index, arr) {
        // 如果这个题目被选中 或 上传过图片
        if (currentValue.isSel === true) {
          // eslint-disable-next-line no-new-object
          var obj = new Object()
          // 每道题上传的图片
          if (currentValue.tupians !== undefined) {
            obj.SUBJECT_ID = currentValue.ID
            obj.tupians = currentValue.tupians
          }
          // 每道题的情况说明
          if (currentValue.desc !== undefined && currentValue.desc !== '') {
            obj.SUBJECT_ID = currentValue.ID
            obj.DESC = currentValue.desc
          }
          // 题目选中过
          currentValue.chooses.forEach(function (choosesCurrent, choosesIndex, choosesArr) {
            if (choosesCurrent.select === true) {
              obj.SUBJECT_ID = currentValue.ID
              obj.CHOOSE_ID = choosesCurrent.ID
              obj.POINTS = choosesCurrent.POINTS
            }
          })
          _this.answers.push(obj)
          // console.log(_this.answers)
          isSelect = true
        }
      })
      if (isSelect === true) {
        // 把评语存在每个对应数据 的新属性 result里面
        this.$set(this.arr, 'result', this.result)
        // 结果展示
        this.tableShow = true
        this.tableList = this.arr
      } else {
        Toast('请至少选择一题作答')
      }
    },
    // 清空画布
    handleReset () {
      this.$refs.esign.reset()
    },
    // 提交确认
    writeCncel () {
      this.writeShow = false
      if (this.doctorsList.length > 0 || this.teamList.length > 0) {
        this.isPop = true
      } else {
        this.getSubmit()
      }
    },
    // 生成图片
    handleGenerate () {
      this.$refs.esign.generate().then(res => {
        this.$http.imgUpload({base64: res})
          .then(res => {
            console.log(res)
            if (res.data.status === 'success') {
              this.writeShow = false
              this.sign_url = res.data.data.url
              this.$set(this.arr, 'sign_url', this.sign_url)
              if (this.doctorsList.length > 0) {
                this.isPop = true
              } else {
                this.NoDoctor = true
                // this.getSubmit()
              }
            }
          })
          .catch(err => {
            console.log(err)
          })
      }).catch(err => {
        console.log(err)
        Toast('请签字确认') // 画布没有签字时会执行这里 'Not Signned'
      })
    },
    // 提交接口
    getSubmit (AUDIT_STATE) {
      var FILES, DESC
      if (this.arr.FILES !== undefined && this.arr.FILES.length > 0) {
        FILES = this.arr.FILES
      } else {
        FILES = null
      }
      if (this.arr.DESC !== undefined && this.arr.DESC !== null) {
        DESC = this.arr.DESC
      } else {
        DESC = ''
      }
      // eslint-disable-next-line camelcase
      var assess_type = sessionStorage.getItem('assess_type')

      // 初步诊断
      var diagnose = sessionStorage.getItem('diagnose')

      // 目前状况
      var current_status = sessionStorage.getItem('current_status')

      let AUDIT_USER_ID = ''
      if (this.select_team_ID) { // 选团队
        AUDIT_USER_ID = this.assess_audit_user_id
      } else { // 直接选医生
        AUDIT_USER_ID = this.select_doc_ID
      }

      this.$http.submit({
        'ASSESS_ID': this.arr.ID,
        'ASSESS_RESULT': this.result,
        'ALL_POINTS': this.ALL_POINTS,
        'TYPE': this.type,
        'FILES': FILES,
        'DESC': DESC,
        'ASSESS_SELF_TYPE': this.assessid,
        'ACCEPT_USER_ID': this.ACCEPT_USER_ID,
        'AUDIT_STATE': AUDIT_STATE,
        'ANSWERS': this.answers,
        'assess_type': assess_type, // 类别 （门诊、住院、居家）
        'diagnose': diagnose, // 初步诊断
        'current_status': current_status,
        sign_url: this.sign_url,
        assess_user_name: this.assess_user_name,
        'AUDIT_USER_ID': AUDIT_USER_ID, // 复评医生id
        team_id: this.select_team_ID // 复评团队id
      })
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.returnID = res.data.data

            this.$set(this.arr, 'isSend', true)
            this.selectList[Number(this.ListIndex)].isSend = true
            // 签名地址
            this.sign_url = ''
            // 选中 医生或团队
            this.select_doc_ID = ''
            this.select_team_ID = ''

            var isgo = false
            this.ListIndex++
            for (var i = 0; i < this.listAll.length; i++) {
              if (this.listAll[i].isSend === true) {
                isgo = true
              } else {
                // eslint-disable-next-line no-return-assign
                isgo = false
                this.ListIndex = i
                break
              }
            }
            if (isgo === true) {
              this.$router.go(-5)
              return false
            }
            this.arr = this.listAll[Number(this.ListIndex)]
            this.isLoading = false
            this.ALL_POINTS = 0
            this.result = ''
            this.answers = []
            this.tableShow = false

            // 清除签名画布
            this.handleReset()

            console.log(this.listAll)
            console.log(this.selectList)
            sessionStorage.removeItem('diagnose')
            sessionStorage.removeItem('current_status')
          } else {
            Toast('网络错误请重新提交')
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 结果展示的关闭
    tabResultLook () {
      this.tableShow = false
      if (this.selfInformation.name == this.assess_user_name) {
        this.writeShow = true
      } else {
        if (this.doctorsList.length > 0) {
          this.isPop = true
        } else {
          this.NoDoctor = true
          // this.getSubmit()
        }
      }
    },
    // 选择医生弹窗的确认按钮
    doctorSelectQue () {
      if (this.select_team_ID) {
        if (this.assess_audit_user_id) {
          this.getSubmit(1)
          this.doctorShow = false
          this.teamDoctorShow = false
          window.removeEventListener('scroll', this.scrollBottom, true)
        } else {
          Toast('请选择提交审核的医生或团队')
          return false
        }
      } else {
        if (this.select_doc_ID) {
          this.getSubmit(1)
          this.doctorShow = false
          window.removeEventListener('scroll', this.scrollBottom, true)
        } else {
          Toast('请选择提交审核的医生或团队')
          return false
        }
      }
    },
    // 确认审核
    onConfirm () {
      this.doctorShow = true
      window.addEventListener('scroll', this.scrollBottom, true)
    },
    //  取消审核
    onCancel () {
      this.getSubmit()
    },
    clickLi (index) {
      this.ListIndex = index
      this.arr = this.listAll[index]
      this.show = !this.show
      if (this.arr.ALL_POINTS !== undefined) {
        this.ALL_POINTS = this.arr.ALL_POINTS
      } else {
        this.ALL_POINTS = 0
      }
    },
    // 点击医生
    /*    clickPeople (item, index) {
      if ($('.listArr').eq(index).hasClass('selectDoctor')) {
        $('.listArr').eq(index).removeClass('selectDoctor')
      } else {
        $('.listArr').eq(index).addClass('selectDoctor').siblings().removeClass('selectDoctor')
        this.doctorID = item.USER_ID
      }
    }, */
    // 获取团队成员
    getTeamDoctor () {
      this.$http.findDoctor({assess_audit_user_id: this.ACCEPT_USER_ID, team_id: this.select_team_ID})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.teamDoctorsList = res.data.data
          } else {
            this.$toast(res.data.msg)
          }
        })
        .catch(err => {
          console.log(err)
          this.$toast('您的网络有些拥挤，请稍后再试')
        })
    },
    // 获取当前管理医生列表
    getDoctorList () {
      this.$http.findDoctor({USER_ID: this.ACCEPT_USER_ID, is_manage: 1})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            this.doctorsList = res.data.data
          } else {
            this.$toast(res.data.msg)
          }
        })
        .catch(err => {
          console.log(err)
          this.$toast('您的网络有些拥挤，请稍后再试')
        })
    },
    getTeamList () {
      this.popLoading = true
      this.$http.TeamList({
        page: this.page,
        is_manage: 1,
        USER_ID: this.ACCEPT_USER_ID
      })
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            var _this = this
            if (Number(this.page) === 1) {
              this.teamList = []
            } else {
            }
            res.data.data.forEach(function (curr, index, arr) {
              // if (curr.manager_doc_name) { // 无责任医生的不显示
              _this.teamList.push(curr)
              // }
            })
            if (res.data.data.length > 0 && this.doctorShow == true) {
              window.addEventListener('scroll', this.scrollBottom, true)
              this.isScroll = true
            } else {
              window.removeEventListener('scroll', this.scrollBottom, true)
              this.isScroll = false
            }
            this.popLoading = false
          } else {
            this.$toast(res.data.msg)
          }
        })
        .catch(err => {
          console.log(err)
          this.$toast('您的网络有些拥挤，请稍后再试')
        })
    },
    // // 获取所有医生信息
    // DoctorListByMine () {
    //   this.$http.getDoctorListByMine({name: this.Searchvalue, type: this.value1, ass_bpinggu_id: this.ACCEPT_USER_ID})
    //     .then(res => {
    //       console.log(res)
    //       if (res.data.status === 'success') {
    //         this.doctorsList = res.data.data
    //       }
    //     })
    //     .catch(err => {
    //       console.log(err)
    //     })
    // },
    // 获取医生类型
    getJiankangServiceList () {
      this.$http.jiankangServiceList()
        .then(res => {
          console.log(res)
          var _this = this
          if (res.data.status === 'success') {
            res.data.data.forEach(function (current, index, arr) {
              var obj = {text: current.dict_name, value: current.dict_order}
              _this.option1.push(obj)
            })
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // // 搜索
    // onSearch () {
    //   this.DoctorListByMine()
    // },
    // onChange () {
    //   this.DoctorListByMine()
    // },
    // 点击上传过 视频 播放
    PlayVideo () {
      if (this.videoList.length > 0) {
        // console.log(this.videoList)
        window.location.href = this.videoList
      }
    },
    onSwipeLeft () { // 左滑动
      // Toast('左滑')
      this.show = false
    },
    onSwipeRight () { // 右滑动
      Toast('右滑')
    },
    // 点击针对项目
    onSelect (item) {
      this.desc = '' // 图片说明
      this.fileList = [] // 视频存储
      this.videoList = [] // 视频返回后存储
      this.ImgfileList = [] // 图片存储
      this.imgList = [] // 图片返回后存储
      // 默认情况下点击选项时不会自动收起
      // 可以通过 close-on-click-action 属性开启自动收起
      var _this = this
      if (item.name === '整体量表') {
        // 如果存过整体图片
        if (this.arr.FILES !== undefined && this.arr.FILES.length > 0) {
          // 整体图片循环
          this.arr.FILES.forEach(function (currentValue, index, arr) {
            if (Number(currentValue.type) === 1) {
              var obj = {
                url: currentValue.url,
                isImage: true
              }
              // 当前后台返回的图片
              _this.imgList.push(currentValue.url)
              // 当前图片存储
              _this.ImgfileList.push(obj)
            } else if (Number(currentValue.type) === 2) {
              _this.fileList.push(currentValue.url)
              _this.videoList = currentValue.url
            }
          })
        } else { // 整体量表没有文件
          this.desc = '' // 图片说明
          this.fileList = [] // 视频存储
          this.videoList = [] // 视频返回后存储
          this.ImgfileList = [] // 图片存储
          this.imgList = [] // 图片返回后存储
        }
        // // 存过情况说明
        if (this.arr.DESC !== undefined && this.arr.DESC !== null) {
          this.desc = this.arr.DESC
        }
      } else {
        // 选小题
        // 如果存过图片
        if (this.nowItem.tupians !== undefined && this.nowItem.tupians.length > 0) {
          this.nowItem.tupians.forEach(function (currentValue, index, arr) {
            if (Number(currentValue.type) === 1) {
              var obj = {
                url: currentValue.url,
                isImage: true
              }
              // 当前后台返回的图片
              _this.imgList.push(currentValue.url)
              // 当前图片存储
              _this.ImgfileList.push(obj)
            } else if (Number(currentValue.type) === 2) {
              _this.fileList.push(currentValue.url)
              _this.videoList = currentValue.url
            }
          })
        }
        // 存过情况说明
        if (this.nowItem.desc !== undefined && this.nowItem.desc !== null) {
          this.desc = this.nowItem.desc
        }
      }
      this.showPicker = false
      this.zhenDuiName = item.name
    },
    // 点击上传
    Shangchuan () {
      if (this.desc !== '' || this.fileList.length > 0 || this.ImgfileList.length > 0) {
        // 整体量表存储
        if (this.imgSend === true && this.zhenDuiName === '整体量表') { // 整体上传资料
          document.title = '评定量表填写'
          var FILES = []
          if (this.ImgfileList.length > 0) {
            // 当前题目加一个 tupians属性
            this.imgList.forEach(function (currentValue, index, arr) {
              var obj = {
                type: '1',
                url: currentValue
              }
              FILES.push(obj)
            })
          }
          var att = {
            type: '2',
            url: this.videoList
          }
          if (this.fileList.length > 0) {
            FILES.push(att)
          }
          if (this.fileList.length > 0 || this.ImgfileList.length > 0) {
            this.arr.FILES = FILES
          }
          // 当前题目加一个 desc属性 情况详情描述
          this.arr.DESC = this.desc
          // 是否有图片上传 或 选择过
          this.nowItem.isSel = true
          // 是否传过图片或视频
          this.nowItem.isSendFile = true
          this.nowItem = '' // 当前item
          this.imgList = []
          this.ImgfileList = []
          this.isZiliao = false // 资料关闭按钮
          this.actions = [] // 针对项目所有选项
          this.zhenDuiName = '' // 针对项目为空
          console.log(this.arr)
        } else if (this.imgSend === true) { // 小题上传资料
          document.title = '评定量表填写'
          var tupians = []
          if (this.ImgfileList.length > 0) {
            // 当前题目加一个 tupians属性
            this.imgList.forEach(function (currentValue, index, arr) {
              var obj = {
                type: '1',
                url: currentValue
              }
              tupians.push(obj)
            })
          }
          // eslint-disable-next-line no-redeclare
          var att = {
            type: '2',
            url: this.videoList
          }
          if (this.fileList.length > 0) {
            tupians.push(att)
          }
          if (this.fileList.length > 0 || this.ImgfileList.length > 0) {
            this.nowItem.tupians = tupians
          }
          // 当前题目加一个 desc属性 情况详情描述
          this.nowItem.desc = this.desc
          // 是否有图片上传 或 选择过
          this.nowItem.isSel = true
          // 是否传过图片或视频
          this.nowItem.isSendFile = true
          console.log(this.nowItem)
          this.nowItem = '' // 当前item
          this.imgList = []
          this.ImgfileList = []
          this.isZiliao = false // 资料关闭按钮
          this.actions = [] // 针对项目所有选项
          this.zhenDuiName = '' // 针对项目为空
          window.sessionStorage['isZiliao'] = this.isZiliao
        } else {
          Toast('视频或图片正在压缩中，请稍后')
        }
      } else {
        Toast('内容空空如也不能提交哦')
      }
    },
    // 点击资料返回 确认按钮
    imgBackConfirm () {
      document.title = '评定量表填写' // 网址title
      this.nowItem = '' // 当前的item
      this.desc = '' // 当前情况说明
      this.imgList = [] // 当前图片存储
      this.ImgfileList = [] // 当前图片显示存储
      this.isZiliao = false // 资料关闭按钮
      this.fileList = [] // 当前视频显示存储
      this.videoList = [] // 当前视频存储
      this.actions = [] // 针对项目所有选项
      this.zhenDuiName = '' // 针对项目为空
    },
    // 点击资料返回
    zlBack () {
      if (this.ImgfileList.length > 0 || this.fileList.length > 0) {
        this.imgBackToast = true
      } else {
        this.imgBackConfirm()
      }
    },
    // 点击资料
    clickZL (item) {
      if (this.doctorsList.length > 0) {
        var NameObj = {
          name: item.SUBJECT_NAME
        }
        this.actions.push(NameObj)
        var allName = {
          name: '整体量表'
        }
        this.actions.push(allName)
        this.zhenDuiName = item.SUBJECT_NAME
        document.title = '评定相关资料'
        var _this = this
        this.nowItem = item
        this.desc = ''
        this.imgList = []
        this.ImgfileList = []
        this.fileList = []
        this.videoList = []
        if (this.zhenDuiName === '整体量表') {
          if (this.arr.DESC !== undefined && this.arr.DESC !== null) {
            this.desc = this.arr.DESC
          }
          // 如果存过图片
          if (this.FILES !== undefined && this.FILES.length > 0) {
            this.FILES.forEach(function (currentValue, index, arr) {
              if (Number(currentValue.type) === 1) {
                var obj = {
                  url: currentValue.url,
                  isImage: true
                }
                // 当前后台返回的图片
                _this.imgList.push(currentValue.url)
                // 当前图片存储
                _this.ImgfileList.push(obj)
              } else if (Number(currentValue.type) === 2) {
                _this.fileList.push(currentValue.url)
                _this.videoList = currentValue.url
              }
            })
          }
        } else {
          if (item.desc !== undefined && item.desc !== null) {
            this.desc = item.desc
          }
          // 如果存过图片
          if (item.tupians !== undefined && item.tupians.length > 0) {
            item.tupians.forEach(function (currentValue, index, arr) {
              if (Number(currentValue.type) === 1) {
                var obj = {
                  url: currentValue.url,
                  isImage: true
                }
                // 当前后台返回的图片
                _this.imgList.push(currentValue.url)
                // 当前图片存储
                _this.ImgfileList.push(obj)
              } else if (Number(currentValue.type) === 2) {
                _this.fileList.push(currentValue.url)
                _this.videoList = currentValue.url
              }
            })
          }
        }
        this.isZiliao = true
      } else {
        Toast('您目前暂无可审核人员')
      }
    },
    // 图片上传之后
    updateFile (file) {
      this.fileUpload(file, 0)
    },
    // 上传图片请求操作
    fileUpload (file, i) {
      if (file.length === undefined) {
        this.imgSend = false
        file.status = 'uploading'
        file.message = '正在压缩中...'
        lrz(file.file, {
          width: 2000,
          quality: 0.7 // 图片压缩质量，取值0-1，默认为0.7
        })
          .then((rst) => {
            this.$http.imgUpload({base64: rst.base64})
              .then(res => {
                console.log(res)
                if (res.data.status === 'success') {
                  this.imgList.push(res.data.data.url)
                  this.imgSend = true
                  file.status = ''
                  file.message = ''
                }
              })
              .catch(err => {
                console.log(err)
              })
          })
          .catch((error) => {
            console.log('失败', error)
            // this.fileUpload(file[i].content, file, i)
            // 失败时执行
          })
      } else {
        if (i === file.length) {
          this.imgSend = true
          return false
        }
        this.imgSend = false
        if (i === 0) {
          for (var j = 0; j < file.length; j++) {
            file[j].status = 'uploading'
            file[j].message = '正在压缩中...'
          }
        }
        lrz(file[i].file, {
          width: 2000,
          quality: 0.7 // 图片压缩质量，取值0-1，默认为0.7
        })
          .then((rst) => {
            this.$http.imgUpload({base64: rst.base64})
              .then(res => {
                console.log(res)
                if (res.data.status === 'success') {
                  this.imgList.push(res.data.data.url)
                  file[i].status = ''
                  file[i].message = ''
                  i++
                  this.fileUpload(file, i)
                }
              })
              .catch(err => {
                console.log(err)
              })
          })
          .catch((error) => {
            console.log('失败', error)
          })
      }
    },
    // 视频上传
    afterRead (file) {
      file.status = 'uploading'
      file.message = '正在压缩中...'
      this.imgSend = false
      this.$http.videoUpload({base64: file.content})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            file.status = ''
            file.message = ''
            this.imgSend = true
            this.videoList = res.data.data.url
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 选择题目
    clickChoose (choose, chooseitem, item) {
      var _that = this
      item.chooses.forEach(function (currentValue, index, arr) {
        // 当前的等于遍历的
        if (currentValue.ID === chooseitem.ID) {
          // 选择过
          if (currentValue.select === true) {
            _that.$set(currentValue, 'select', false)
            _that.ALL_POINTS -= currentValue.POINTS
            _that.$set(_that.arr, 'ALL_POINTS', _that.ALL_POINTS)
            _that.$set(item, 'isSel', false)
          } else { // 未选择过
            _that.$set(currentValue, 'select', true)
            _that.ALL_POINTS += currentValue.POINTS
            _that.$set(_that.arr, 'ALL_POINTS', _that.ALL_POINTS)
            _that.$set(item, 'isSel', true)
          }
        } else { // 当前的不等于遍历的
          // 如果选择过
          if (currentValue.select === true) {
            _that.$set(currentValue, 'select', false)
            _that.ALL_POINTS -= currentValue.POINTS
            _that.$set(_that.arr, 'ALL_POINTS', _that.ALL_POINTS)
          }
        }
      })
      this.getResult(item.ID, _that.ALL_POINTS)
    },
    // 根据评估表ID和分数获取评估结果
    getResult (id, allPoints) {
      this.$http.getResult({'ASSESS_ID': id, 'ALL_POINTS': allPoints})
        .then(res => {
          // console.log(res)
          this.result = res.data.RESULT
        })
        .catch(err => {
          console.log(err)
        })
    },
    // 获取当前列表题目
    getList () {
      var _that = this
      this.selectList.forEach(function (currentValue, index, arr) {
        var id = arr[index].ID
        _that.getSub(id)
      })
    },
    // 获取所有题目
    getSub (id) {
      this.list.push(
        new Promise((resolve, reject) => {
          this.$http.getSubjects({ID: id})
            .then(res => {
              return resolve(res.data)
            }).catch(_ => {
              return resolve('') // 注意
            })
        })
      )
      Promise.all(this.list).then(res => {
        // console.log(res)
        this.listAll = res
        this.arr = this.listAll[Number(this.ListIndex)]
        this.isLoading = false
      }).catch(_ => {
        // 错误时的处理
      })
    },
    // 点击返回
    back () {
      this.$router.history.go(-1)
    }
  },
  destroyed () {
    window.removeEventListener('scroll', this.scrollBottom, true)
  }
}
</script>

<style scoped>
  ul, li {
    list-style: none;
  }
  .all{
    width: 100%;
    height: 100%;
    background: #FAF9FE;
    font-family: "PingFang SC";
    overflow: auto;
  }
  header{
    width: 100%;
    height: 12vw;
    display: flex;
    align-items: center;
    background: #FFFFFF;
    position: sticky;
    top: 0;
    border-bottom: 1px solid #e5e5e5;
  }
  .div{
    width: 33%;
    height: 100%;
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: bold;
    font-family: "PingFang SC";
  }
  .div:nth-child(1) img{
    width: 7px;
    height: 13px;
    margin: 0 5px 0 15px;
  }
  .div:nth-child(2) {
    justify-content: center;
  }
  .div:nth-child(3) {
    justify-content: flex-end;
  }
  .div:nth-child(3) span{
    margin-right: 15px;
  }
  .side{
    color: #1da4f2;
  }
  .peopletitle{
    width: 92%;
    height: 50px;
    background: linear-gradient(90deg, #1DA3F2, #1DC7F2);
    color: white;
    margin: 10px auto 5px auto;
    border-radius: 10px;
    padding: 0 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: bold;
  }
  .peopletitle span{
    margin-left: 5px;
  }
  .peopletitle img{
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
  }
  .title{
    width: 92%;
    height: 75px !important;
    margin: 10px auto 5px auto;
    background: #FFFFFF;
    box-shadow: 0px -2px 30px 0px rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 10px;
    box-sizing: border-box;
  }
  .title p:nth-child(1) {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 10px;
  }
  .title p{
    display: flex;
    align-items: center;
  }
  .title button{
    height: 20px;
    /*background: #1DA4F2;*/
    border-radius: 10px;
    font-size: 11px;
    border: none;
    padding: 0 8px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    /*margin-right: 5px;*/
    border: 1px solid #1da4f2;
  }
  .title button:nth-child(1){
    color: #1da4f2;
    background: #FFFFFF;
  }
  .title .checkBtn{
    color: #FFFFFF;
    background: #1da4f2;
  }
  .title button img{
    width: 14px;
    height: 14px;
    margin-right: 5px;
  }
  .content{
    overflow: auto;
    padding: 5px 0;
    box-sizing: border-box;
  }
  .content ul,
  .tabContent ul
  {
    width: 92%;
    padding: 10px 10px 5px 10px;
    box-sizing: border-box;
    background: #FFFFFF;
    margin: auto auto 5px auto;
    border-radius: 10px;
    /*box-shadow: 0px -2px 30px 0px rgb(0 0 0 / 5%);*/
  }
  .liHeader{
    width: 100%;
    font-size: 15px;
    display: flex;
    margin-bottom: 5px;
    justify-content: space-between;
  }
  .liHeader p:nth-child(1){
    width: 65%;
  }
  .liHeader p:nth-child(2){
    width: 120px;
    display: flex;
    align-items: flex-end;
  }
  .liHeader p{
    margin-bottom: 8px;
    /*background: #07c160;*/
  }
  .p_btn{
    display: flex;
    justify-content: flex-end;
  }
  .p_btn img{
    width: 18px;
    height: 18px;
  }
  .liHeader p button{
    height: 18px;
    border: 1px solid #1DA4F2;
    background: #FFFFFF;
    color: #1da4f2;
    border-radius: 10px;
    padding: 0 8px;
    box-sizing: border-box;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
  }
  .liChoos{
    font-size: 13px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
  }
  .selectBtn{
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 5px;
  }
  .bottom{
    position: absolute;
    bottom: 0px;
    width: 100%;
    /*height: 139px;*/
    /*background: #FFFFFF;*/
    box-shadow: 0px -2px 30px 0px rgba(0, 0, 0, 0.05);
    /*border-radius: 20px 20px 0px 0px;*/
    /*padding: 10px 0;*/
  }
  .bottom ul {
    width: 100%;
    /*margin: 5px auto;*/
    border-radius: 10px;
    /*overflow: hidden;*/
    display: flex;
    height: 130px;

  }
  /*.bottom ul:nth-child(1) {*/
  /*  height: 44px;*/
  /*}*/
  /*.bottom ul:nth-child(2) {*/
  /*  height: 65px;*/
  /*}*/

  .bottom ul li{
    display: flex;
    height: 100%;
    align-items: center;
    background: #FFFFFF ;
  }
  .bottom ul li:nth-child(1){
    width: 30%;
    padding: 0 10px;
    box-sizing: border-box;
    color: #1da4f2;
    background: #E8F6FE;
    justify-content: center;
    border-radius: 10px 0 0px 10px;
    font-size: 15px;
  }
  .bottom ul li:nth-child(2){
    width: 70%;
    padding: 0 10px;
    box-sizing: border-box;
    border:1px solid rgba(29, 164, 242, 0.1);
    border-radius: 0 10px 10px 0;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    font-size: 13px;
  }
  .bottom ul li textarea{
    width: 100%;
    resize: none;
    height: 80%;
    margin: 8px 0;
    /*margin-bottom: 5px;*/
    border: none;
  }
  .bottom ul li p{
    width: 100%;
    font-size: 11px;
    font-family: PingFang SC;
    font-weight: 500;
    color: #999999;
    text-align: right;
  }
  .pop li{
    height: 75px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
    border-bottom: 1px solid #E5E5E5;
  }
  .pop li img{
    width: 18px;
    height: 18px;
    margin-right: 8px;
  }
  .pop li span{
    width: 75%;
  }
  .dian{
    width: 5px;
    height: 5px;
    border-radius: 50%;
    margin-right: 5px;
  }
  .dian1{
    background: #E3170D;
  }
  .dian2{
    background: rgba(46, 196, 155, 1);
  }
  .jiaoBiao{
    width: 75px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  .jiaoBiao1{
    color: #E3170D;
  }
  .jiaoBiao2{
    color: rgba(46, 196, 155, 1);
  }
/*  资料上传*/
  .zlTitle{
    width: 100%;
    font-size: 15px;
    background: #fff;
  }
  .textareaDiv{
    width: 95%;
    height: 150px;
    background: #FAF9FE;
    border-radius: 10px;
    margin: 0 auto;
    overflow: hidden;
  }
  .shuoming{
    font-size: 13px;
    color: #999999;
    display: flex;
    flex-direction: row-reverse;
    margin-right: 10px;
    margin-bottom: 5px;
  }
  .textareaDiv textarea{
    resize: none;
    width: 100%;
    height: 80%;
    overflow: auto;
    background: transparent;
    border: none;
    padding: 10px;
    box-sizing: border-box;
  }
  .zlMenu,
  .videoMenu,
  .imgMenu{
    width: 100%;
    height: 44px;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    font-size: 15px;
  }
  .label{
    width: 100%;
    height: 44px;
    background: #fff;
    display: flex;
    align-items: center;
    font-size: 15px;
  }
  .zlMenu a,
  .videoMenu_left a,
  .imgMenu a,
    .hengGang
  {
    width: 2px;
    height: 15px;
    background: #1da4f2;
    margin: 0 5px 0 15px;
    display: block;
  }
  .videoMenu,
  .imgMenu
  {
    justify-content: space-between;
    /*margin-top: 5px;*/
  }
  .videoMenu li:last-child,
  .imgMenu li:last-child
  {
    margin-right: 15px;
    color: #999999;
  }
  .videoMenu_left,
  .imgMenu_left
  {
    width: 50%;
    display: flex;
    align-items: center;
  }
  .videoMenu_left a,
  .imgMenu a
  {
    display: block;
  }
  .videoUpload{
    width: 100%;
    background: #FFFFFF;
    padding: 0 10px;
    box-sizing: border-box;
  }
  .zlMenu{
    display: flex;
    justify-content: space-between;
  }
  .zlMenu div{
    display: flex;
    align-items: center;
  }
  .zlMenu div:nth-child(2) img{
    width: 13px;
    height: 7px;
    margin-right: 15px;
  }
  /*针对项目弹窗*/
  .wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
  }
  .block {
    width: 90%;
    height: 200px;
    border-radius: 10px;
    background-color: #fff;
  }
  .block .pHeader{
    width: 100%;
    height: 50px;
    border-bottom: 1px solid #E5E5E5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-family: PingFang SC;
    font-weight: bold;
  }
  .block ul{
    width: 100%;
    padding: 0 10px;
    box-sizing: border-box;
  }
  .block ul li{
    padding: 10px;
    border-bottom: 1px solid #E5E5E5;
    box-sizing: border-box;
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: 500;
    color: #333333;
    display: flex;
    align-items: center;
  }
  .yuan{
    display: block;
    width: 10px;
    min-width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #1da4f2;
    margin-right: 10px;
  }
  .popDiv{
    width: 100%;
    height: 100%;
    background: #FAF9FE;
    overflow: auto;
    font-size: 15px;
    font-family: PingFang SC;
  }
  .popTop{
    background: white;
    position: sticky;
    top: 0;
    z-index: 999;
    border-bottom: 1px solid #E5E5E5;
    font-size: 15px;
  }
  .popHeader{
    width: 100%;
    height: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    box-sizing: border-box;
    border-bottom: 1px solid #E5E5E5;
  }
  .search{
    width: 100%;
    height: 44px;
    background: #FFFFFF;
    display: flex;
    align-items: center;
  }
  /deep/ .van-dropdown-menu{
    width: 30%;
    height: 100%;
    overflow: hidden;
  }
  /deep/ .van-dropdown-menu__bar{
    box-shadow: none;
  }
  /deep/ .van-search{
    width: 75%;
    height: 100%;
  }
  .popCon{
    overflow: scroll;
  }
  .popCon ul{
    width: 100%;
    margin: 0 auto;
    /*background: #FFFFFF;*/
    /*border-bottom: 1px solid #E5E5E5;*/
  }
  /*.listArr:last-child{*/
  /*  margin-bottom: 20px;*/
  /*}*/
  .popCon ul img{
    width: 30px;
    height: 30px;
    border-radius: 50%;
  }
  .popCon ul li{
    padding: 0 10px;
    box-sizing: border-box;
  }
  /*.listArr{*/
  /*  background: #fff;*/
  /*}*/
  /*.popCon_liHeader{*/
  /*  height: 44px !important;*/
  /*  display: flex;*/
  /*  align-items: center;*/
  /*}*/
  .popCon_liHeader span{
    margin-left: 10px;
  }
  .popCon ul li{
    width: 100%;
    height: 25px;
    display: flex;
    align-items: center;
    font-size: 13px;
    font-family: PingFang SC;
    font-weight: 500;
    color: #666666;
  }
  .popCon ul li button{
    border-radius: 10px;
    margin-left: 10px;
    padding: 3px 5px;
    box-sizing: border-box;
    border: none;
    background: #1DA4F2;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 11px;
    font-family: PingFang SC;
    font-weight: 500;
    color: #FFFFFF;
  }
  /*.maoHao{*/
  /*  margin-right: 4px;*/
  /*  margin-left: 2px;*/
  /*}*/
  .goodAt{
    width: 80%;
    display: block;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;

  }
  /*.li_zhuanye{*/
  /*  height: auto !important;*/
  /*  margin-bottom: 8px;*/
  /*  display: flex;*/
  /*  align-items: flex-start !important;*/
  /*}*/
  /*.typeTitle{*/
  /*  display: block;*/
  /*  width: 55px;*/
  /*  text-align: justify;*/
  /*  text-align-last: justify;*/
  /*}*/
  .selectDoctor{
    background: rgba(29, 164, 242, 0.1) !important;
  }
  .tabTop{
    position: sticky;
    top: 0;
    z-index: 999;
    background: white;
  }
  .tab{
    background: #FAF9FE;
  }
  .tabHeader{
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #E5E5E5;
    font-family: "PingFang SC";
    font-size: 15px;
    font-weight: bold;
    background: #FFFFFF;
    position: sticky;
    top: 0;
  }
  .tabHeader div{
    display: flex;
  }
  .tabHeader div:nth-child(1),
  .tabHeader div:nth-child(3){
    width: 25%;
  }
  .tabHeader div:nth-child(2){
    width: 50%;
    justify-content: center;
  }
  .tabHeader div:last-child{
    justify-content: flex-end;
    padding-right: 10px;
    box-sizing: border-box;
  }
  .solt{
    color: #1DA4F2;
  }
  .tabTitle{
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
justify-content: center;
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: bold;
    color: #333333;
    padding: 0 15px;
    box-sizing: border-box;
    background: #FFFFFF;
  }
  .tabPerson{
    font-size: 13px;
    font-family: PingFang SC;
    font-weight: 500;
    color: #333333;
    background: #fff;
  }
  .tabName{
    height: 30px!important;
    font-size: 15px !important;
    font-weight: bold !important;
  }
  .tabTextarea{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 0;
    box-sizing: border-box;
  }
  .tabTextarea textarea{
    width: 95%;
    height: 75px;
    background: #FFFFFF;
    border: 1px solid #999999;
    border-radius: 5px;
    resize: none;
    padding: 10px;
    box-sizing: border-box;
    overflow: auto;
  }
  .tabPerson p{
    height: 30px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    box-sizing: border-box;
  }
  .tabPerson p span{
    margin-right: 20px;
  }
  table{
    border: 1px solid #E5E5E5;
  }
  table th, td{
    font-size: 13px;
    padding: 10px 5px;
    box-sizing: border-box;
    border-left: 1px solid #E5E5E5;
    text-align: center;
  }
  td{
    border-bottom: 1px solid #E5E5E5;
  }
  table th, td:nth-child(1) {
    width: 15%;
  }
  table th, td:nth-child(2) {
    width: 35%;
  }
  table th, td:nth-child(3) {
    width: 35%;
  }
  table th, td:nth-child(4) {
    width: 15%;
  }
  /deep/ .van-uploader__input{
    border: 1px solid #E5E5E5;
  }
  .writeDiv{
    width: 90%;
    background: #E5E5E5;
    margin: 0px auto;
    background: #FAF9FE;
    border: 1px solid #999999;
    border-radius: 5px;
    overflow: hidden;
  }
  .writeButton{
    width: 90%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 5%;
    position: absolute;
    bottom: 0;
  }
  .writeButton button{
    width: 49%;
    height: 44px;
    background: #FFFFFF;
    border: 1px solid #1DA4F2;
    border-radius: 5px;
    font-size: 17px;
    font-family: PingFang SC;
    font-weight: bold;
    color: #1da4f2;

  }
  .backBlue{
    color: #FFFFFF !important;
    background: linear-gradient(90deg, #1DA3F2, #1DC7F2)!important;
  }
  .backFFF{
    background: #fff!important;
  }
  .menu{
    width: 100%;
    height: 60px;
    background: #1DA4F2;
    box-shadow: 0px 1px 0px 0px #E5E5E5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow:hidden;
  }
  /*/ 选择框 开始样式/*/
  /deep/ .el-steps--horizontal{
    width: 105%;
  }
  /deep/ .el-step.is-center .el-step__description{
    padding: 0;
  }
  /deep/ .el-step__description{
    margin: 0;
    font-size: 13px;
  }
  /deep/ .el-step__icon{
    width: auto;
    height: auto;
  }
  /deep/ .el-step__icon.is-text{
    border: none;
  }
  /deep/ .is-finish,
  /deep/ .el-step__description.is-process{
    color: #fff;
  }
  /deep/ .el-step__description.is-finish{
    color: white !important;
  }
  /deep/ .el-step__description.is-wait{
    color: rgba(255, 255, 255, 0.7);
  }
  /deep/ .el-step__head.is-finish{
    border-color: #fff;
  }
  /deep/ .el-step__head.is-wait{
    border-color: transparent !important;
  }
  /deep/ .el-step__line{
    border-color: transparent !important;
  }
  /deep/ .el-step.is-horizontal .el-step__line{
    height: 1px;
    /*top:7px;*/
    top: 35%;
  }
  /deep/ .el-step__line{
    background: white;
  }
  /*/ 选择框 结束样式/*/

  .tabBar{
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
  }
  .tabBar li {
    width: 90px;
    height: 29px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1da5f2;
    margin-left: -2px;
    background: #FFFFFF;
  }
  .tabBar li:first-child{
    border-radius: 5px 0 0 5px;
  }
  .tabBar li:last-child{
    border-radius: 0 5px 5px 0;
  }
  .selectMenu{
    background: #1da5f2 !important;
    color: #FFFFFF !important;
  }

  .box{
    padding: 10px;
    box-sizing: border-box;
    background: white;
    margin-bottom: 8px;
    display: flex;
  }
  .all .box:last-of-type{
    margin-bottom: 60px;
  }
  .PHOTO{
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
  }
  .box_left{
    width: 23%;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: space-between;
  }
  .dict_name{
    font-size: 11px;
    border: 1px solid #1DA4F2;
    border-radius: 2px;
    background: rgba(16, 184, 246, 0.1);
    color: #1da4f2;
    padding: 1px 3px;
    box-sizing: border-box;
    white-space: nowrap;
    /*margin-top: 10px;*/
  }
  .box_right{
    width: 78%;
  }
  .box_right ul{
    /*height: 60px;*/
    display: flex;
    flex-direction: column;
    align-content: space-around;
    justify-content: space-around;
  }
  .box_right ul li{
    display: flex;
    align-items: center;
    font-size: 13px;
    font-family: PingFang SC;
    min-height: 25px;
  }
  .box_right ul li:nth-child(1){
    justify-content: space-between;
  }
  .name{
    font-size: 15px!important;
    font-weight: bold;
    color: #333333;
  }
  .biaoqian{
    /*padding: 0px 8px;*/
    min-width: 44px;
    height: 18px;
    border-radius: 15px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    /* background: rgba(29, 164, 242, 0.1); */
    background: transparent;
    color: #1DA4F2;
    /* border: none; */
    border: 1px solid;
    font-size: 11px;
    margin-left: 8px;
  }
  .btnXiangQing{
    color: white;
    background: #1DA4F2;
    border: none;
    padding: 3px 8px;
    border-radius: 2px;
    box-sizing: border-box;
    font-size: 11px;
  }
  .btnXiangQing img{
    width: 5px;
    height: 9px;
    margin-left: 5px;
  }

  .btnXiangQing,
  .biaoqian,
  .jieShao
  {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .jieShao{
    font-size: 13px;
    font-family: PingFang SC;
    font-weight: 500;
    color: #333333;
    margin-right: 8px;
  }
  .box_rigth_bottom{
    margin-top: 5px;
  }
  .box_rigth_bottom p{
    margin-bottom: 5px;
  }
  .box_rigth_bottom p:nth-child(1),
  .box_rigth_bottom p:nth-child(3){
    font-size: 13px;
  }
  .box_rigth_bottom p a{
  }
  .box_rigth_bottom p span{
    color: #E3170D;
    margin: 0 8px 0 3px;
  }
  .goodAt{
    font-size: 13px;
    display: flex;
  }
  .goodAt a{
    display: block;
    white-space: nowrap;
  }
  .goodAt span{
    /*width: 80%;*/
    text-overflow: -o-ellipsis-lastline;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    color: #333 !important;
  }
  .popHeader{
    position: sticky;
    top: 0;
    background: #fff;
  }
</style>
